#include <algorithm>
#include <cstdint>
#include <iostream>
#include <istream>
#include <vector>

using ll = int64_t;

ll n;
bool isCase2=true;
struct V{
    ll a,b,c;
};
std::vector<V> v;

template<class ...Ts>
void log(Ts&&...ts){
    // std::cout<<"Log: ";
    // ((std::cout<<ts<<' '),...);
    // std::cout<<'\n';
}

namespace c1 {
    std::vector<ll> nmax;
    void dfs(ll now,ll div1n,ll div2n){
        nmax[now-1]=std::max(nmax[now-1],std::min(div1n,div2n));
        if(now>n)return;

        for(ll div1=std::min(v[now].a,v[now].b);div1>=0;div1--){
            ll div2=std::min(v[now].b-div1,v[now].c);
            log("now:",now,"div1:",div1,"div2:",div2);
            dfs(now+1,div1n+div1,div2n+div2);
        }
    }
}

int main(){
    std::iostream::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);

    std::cin>>n;
    v.resize(n+1);
    for(ll i=1;i<=n;i++){
        std::cin>>v[i].a>>v[i].b>>v[i].c;
        if(v[i].a+v[i].c>v[i].b){
            isCase2=false;
        }
    }
    if(isCase2){
        ll as{},cs{};
        for(ll i=1;i<=n;i++){
            as+=v[i].a;
            cs+=v[i].c;
            std::cout<<std::min(as,cs)<<'\n';
        }
        return 0;
    }
    // isCase1
    {
        using namespace c1;
        nmax.resize(n+1);
        dfs(1, 0, 0);
        for(ll i=1;i<=n;i++){
            std::cout<<nmax[i]<<'\n';
        }
    }
}

/*
input
3
5 7 5
1 8 8
3 1 2
output
3
6
7

5 7 5 -> (5,2),(4,3),(3,4),(2,5)
1 8 8 -> (1,7),(0,8)
3 1 2 -> (1,0),(0,1)



*/